#ifndef Q3OOBJECTDATA_H_
#define Q3OOBJECTDATA_H_
#include <vector>
#include <fstream>
#include "Q3O_Types.h"
#include "RawObjectData.h"

using namespace std;
/*
*	___ Q3OOBJECTDATA Header___
* 
*
***************************************************************/

class Q3OObjectData : public RawObjectData
{
	private:
		long currByte;
		long maxBytes;
		ifstream *readFile;
		unsigned char majorVersion;
		unsigned char minorVersion;
		long facesCount;
		
		
		////////////////////////////////////////////////////////////////////////
		//version
		////////////////////////////////////////////////////////////////////////
		
		bool IsVersionAtLeast(unsigned char major,unsigned char minor);

		////////////////////////////////////////////////////////////////////////
		//file io 
		////////////////////////////////////////////////////////////////////////

		bool OpenFile(string FileName);

		long ReadSize( );

		bool ReadBlock( char *out ,unsigned long size );

		char* ReadString( );

		////////////////////////////////////////////////////////////////////////
		//q3o reading  functions 
		////////////////////////////////////////////////////////////////////////
			
		bool q3o_readHeader(Q3O_HEADER *header);

		bool q3o_readChunkType(char *c);

		bool q3o_readMeshChunk(Q3O_MESH *mesh, bool withTexture);

		bool q3o_readMaterialChunk( Q3O_MATERIAL *mat );

		bool q3o_readTextureChunk( Q3O_TEXTURE *tex );	

	public:
		Q3OObjectData();		
		~Q3OObjectData();	
		bool loadObject( string filename );



};

#include "RawObjectData.h"

/***************************************************************/
#endif
